#include<bits/stdc++.h>
#define sd(n) scanf("%d",&n) 
#define sld(n) scanf("%lld",&n)
#define pd(n) printf("%d", (n))
#define pld(n) printf("%lld", n)
#define all(x) (x).begin(),(x).end()
#define rall(x) (x).rbegin(),(x).rend()
#define fi first
#define se second
const int N = 1e5+10;
const int maxn = 1e6;
#define INF 0x7fffffff
typedef long long int ll;
using namespace std;
//----------------------------------------------------------------------------//
ll a[N];
ll b[N];
void solve()
{
  int n;
  sd(n);
  int ans = 0;
  for (int i = 1; i <= n; i++) sld(a[i]);

  for (int i = 1; i <= n; i++) b[i] = a[i] + 1L*i;

  for (int i = n; i >= 2; i--)
  {
    if (b[i]> b[i - 1])
    {
      b[i - 1] = b[i];
      ans++;
    }
  }

  pd(ans);
  puts("");
}

int main()
{
  int T = 1;
  //sd(T);
  while (T--)
  {
    solve();
  }

  return 0;
}